ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
EDMA.h File Reference

Enhanced Direct Memory Access driver. More...

Go to the source code of this file.

Defines

#define TRUE   (1u)
#define CLEAR   (0u)
#define BITS_IN_NIBBLE   (4u)
#define BITS_IN_BYTE   (8u)
#define BITS_IN_32   (32u)
#define BITS_IN_16   (16u)
#define BYTES_IN_32   (4u)
#define BYTES_IN_16   (2u)
#define BIT_DEFINITION
#define BIT0   (1u << 0u)
#define BIT1   (1u << 1u)
#define BIT2   (1u << 2u)
#define BIT3   (1u << 3u)
#define BIT4   (1u << 4u)
#define BIT5   (1u << 5u)
#define BIT6   (1u << 6u)
#define BIT7   (1u << 7u)
#define BIT8   (1u << 8u)
#define BIT9   (1u << 9u)
#define BIT10   (1u << 10)
#define BIT11   (1u << 11)
#define BIT12   (1u << 12)
#define BIT13   (1u << 13)
#define BIT14   (1u << 14)
#define BIT15   (1u << 15)
#define BIT16   (1u << 16)
#define BIT17   (1u << 17)
#define BIT18   (1u << 18)
#define BIT19   (1u << 19)
#define BIT20   (1u << 20)
#define BIT21   (1u << 21)
#define BIT22   (1u << 22)
#define BIT23   (1u << 23)
#define BIT24   (1u << 24)
#define BIT25   (1u << 25)
#define BIT26   (1u << 26)
#define BIT27   (1u << 27)
#define BIT28   (1u << 28)
#define BIT29   (1u << 29)
#define BIT30   (1u << 30)
#define BIT31   (1u << 31)
#define CHANNEL_TO_CHANNEL_LINKING_ON_MAJOR_LOOP_EN   (0x80000000u)
#define CHANNEL_TO_CHANNEL_LINKING_ON_MAJOR_LOOP_DIS   (0x00000000u)
#define CHANNEL_TO_CHANNEL_LINKING_ON_MINOR_LOOP_EN   (0x80000000u)
#define CHANNEL_TO_CHANNEL_LINKING_ON_MINOR_LOOP_DIS   (0x00000000u)
#define DMA_8_BIT_SOURCE   (0x00000000u)
#define DMA_16_BIT_SOURCE   (0x01000000u)
#define DMA_32_BIT_SOURCE   (0x02000000u)
#define DMA_64_BIT_SOURCE   (0x03000000u)
#define DMA_8_BIT_TARGET   (0x00000000u)
#define DMA_16_BIT_TARGET   (0x00010000u)
#define DMA_32_BIT_TARGET   (0x00020000u)
#define DMA_64_BIT_TARGET   (0x00030000u)
#define DONT_STALL_DMA   (0x00000000u)
#define STALL_DMA_4_CYCLES   (0x00008000u)
#define STALL_DMA_8_CYCLES   (0x0000C000u)
#define DMA_ISR_HALF_WAY_THROUGH   (0x00000004u)
#define DMA_ISR_WHEN_DONE   (0x00000002u)
#define DMA_START   (0x00000001u)
#define DMA_SIZE_8_BIT   (0x00u)
#define DMA_SIZE_16_BIT   (0x01u)
#define DMA_SIZE_32_BIT   (0x02u)
#define DMA_SIZE_64_BIT   (0x03u)
#define DMA_BWC_NONE   (0x00u)
#define DMA_BWC_4_CYCLE_STALL   (0x02u)
#define DMA_BWC_8_CYCLE_STALL   (0x03u)
#define DMA_MUX_ENABLED   (0x80u)
#define DMA_MUX_DISABLED   (0x00u)
#define DMA_TRIGGER_ENABLED   (0x40u)
#define DMA_TRIGGER_DISABLED   (0x00u)
#define N_ELEMENTS(X)   (sizeof(X)/sizeof(*(X)))
#define CURRENT_MAJOR_ITERATION(xx)   ((uint32_t)((xx) << 16u))
#define DMA_OFFSET(xx)   ((uint32_t)(xx))
#define NUMBER_OF_MAJOR_ITERATIONS(xx)   ((uint32_t)((xx) << 16u))
#define DMA_CLEAR_ISR_FLAG(XX)   EDMA.CIRQR.R = XX
#define DMA_MUX_ENABLE(XX, YY)   DMAMUX.CHCONFIG[XX].B.ENBL = YY

Enumerations

enum  DMA_CHANNEL_STATE { DMA_SERVICE_REQUEST_ASSERTED, DMA_EXECUTING, DMA_COMPLETED_MINOR_LOOP, DMA_COMPLETED_MAJOR_LOOP }
enum  DMA_MUX_SOURCES {
  DMA_SOURCE_DSPI0_TX = 1, DMA_SOURCE_DSPI0_RX, DMA_SOURCE_DSPI1_TX, DMA_SOURCE_DSPI1_RX,
  DMA_SOURCE_DSPI2_TX, DMA_SOURCE_DSPI2_RX, DMA_SOURCE_DSPI3_TX, DMA_SOURCE_DSPI3_RX,
  DMA_SOURCE_CTU, DMA_SOURCE_FIF01, DMA_SOURCE_FIFO2, DMA_SOURCE_FIFO3,
  DMA_SOURCE_FIFO4, DMA_SOURCE_FLEX_PWM_WR, DMA_SOURCE_FLEX_PWM_RD, DMA_SOURCE_ETIMER0_CH0,
  DMA_SOURCE_ETIMER0_CH1, DMA_SOURCE_ETIMER1_CH0, DMA_SOURCE_ETIMER1_CH1, DMA_SOURCE_ADC0,
  DMA_SOURCE_ADC1, DMA_SOURCE_ALWAYS
}

Functions

typedef __attribute__ ((aligned(32))) union
void vfnDMASet (uint8_t u8Chan, uint8_t *pu8DestAddr, uint8_t *pu8SourceAddr, uint16_t u16NOfBytes)
 This function will configure a pre-configured channel for Data transmission in a byte-by-byte manner.
void vfnDMAConfig (TCD_t *ptMyTCD, uint8_t u8Channel)
 This function will configure a channel for DMA action.
void vfnDMAStart (const uint8_t u8Chan)
 This function will Start a DMA loop.
void vfnDMAEnable (const uint8_t u8Chan)
 This function will enable a DMA channel.
uint8_t u8fnDMAPending (const uint8_t u8Chan)
 This function will return a 1 when a DMA transfer is done.
void vfnDMACopyArray (uint8_t *pu8Source, uint8_t *pu8Target, uint16_t u16Size, uint8_t u8Channel)
 Copies an array to a different location using eDMA.
uint8_t u8fnWaitForDMA (uint8_t u8Channel)
 Waits for a major loop of a given channel to expire.
uint8_t u8fnDMAReturnChannelStatus (uint8_t u8Channel)
 Returns the status for a given channel.
void vfnDMAMUXInit (uint8_t u8DMACh, uint8_t u8DMAMuxSource, uint8_t u8Trigger, uint8_t u8Enable)
 Routes a DMAMux channel to the right trigger.
void vfnDMAMuxEnable (uint8_t u8DMACh, uint8_t u8Enable)
 Enables a particular DMAMux channel that has already been configured through vfnDMAMUXInit.
uint8_t u8fnDMAMuxChEnStatus (uint8_t u8DMACh)
 Tells the caller whether a particular DMA channel is enabled or not.

Variables

 TCD_t

Detailed Description

Enhanced Direct Memory Access driver.

Copyright (c) 2011 Freescale Semiconductor Freescale Confidential Proprietary

Author:
Freescale Semiconductor
SASD Automotive
R11515
Version:
Date:
Warning:
(If needed)

History:


Function Documentation

uint8_t u8fnDMAMuxChEnStatus ( uint8_t  u8DMACh)

Tells the caller whether a particular DMA channel is enabled or not.

Parameters:
u8DMACh,:eDMA (0 - 15).
Returns:
1 if enabled, zero if disabled.
uint8_t u8fnDMAPending ( const uint8_t  u8Chan)

This function will return a 1 when a DMA transfer is done.

Parameters:
u8Chan,:Channel to be used (0 - 15)
Returns:
1 when done, 0 otherwise.
uint8_t u8fnDMAReturnChannelStatus ( uint8_t  u8Channel)

Returns the status for a given channel.

Parameters:
u8Channel,:eDMA (0 - 15).
Returns:
Status as defined by DMA_CHANNEL_STATE.
uint8_t u8fnWaitForDMA ( uint8_t  u8Channel)

Waits for a major loop of a given channel to expire.

Parameters:
u8Channel,:eDMA (0 - 15).
Returns:
0 when the DMA copy has been completed, 1 when the function has timed-out.
void vfnDMAConfig ( TCD_t *  ptMyTCD,
uint8_t  u8Channel 
)

This function will configure a channel for DMA action.

Parameters:
ptMyTCD,:Settings for TCD (refer to TCD_t)
u8Chan,:Channel to be used (0 - 15)
Returns:
Void
void vfnDMACopyArray ( uint8_t *  pu8Source,
uint8_t *  pu8Target,
uint16_t  u16Size,
uint8_t  u8Channel 
)

Copies an array to a different location using eDMA.

Parameters:
pu8Source,:Pointer to initial element to copy
pu8Target,:Pointer to initial element to where to copy
u16NOfBytes,:Size in bytes of stream to copy
u8Channel,:eDMA (0 - 15) to use for copy.
Returns:
void.
void vfnDMAEnable ( const uint8_t  u8Chan)

This function will enable a DMA channel.

Parameters:
u8Chan,:Channel to be used (0 - 15)
Returns:
Void
void vfnDMAMuxEnable ( uint8_t  u8DMACh,
uint8_t  u8Enable 
)

Enables a particular DMAMux channel that has already been configured through vfnDMAMUXInit.

Parameters:
u8DMACh,:eDMA (0 - 15).
Returns:
Void.
void vfnDMAMUXInit ( uint8_t  u8DMACh,
uint8_t  u8DMAMuxSource,
uint8_t  u8Trigger,
uint8_t  u8Enable 
)

Routes a DMAMux channel to the right trigger.

Parameters:
u8DMACh,:eDMA (0 - 15).
u8DMAMuxSource,:DMA source as listed in DMA_MUX_SOURCES.
u8Trigger,:non-zero for enable, zero for disable. This variable allows the DMA Mux to be triggered through a PIT channel.
u8Enable,:non-zero to enable the DMA Mux right away, zero to disable.
Returns:
Void.
void vfnDMASet ( uint8_t  u8Chan,
uint8_t *  pu8DestAddr,
uint8_t *  pu8SourceAddr,
uint16_t  u16NOfBytes 
)

This function will configure a pre-configured channel for Data transmission in a byte-by-byte manner.

Parameters:
u8Chan,:Channel to be used (0 - 15)
pu8DestAddr,:Where data will be copied to.
pu8SourceAddr,:Where data comes from
u16NOfBytes,:Self-explanatory.
Returns:
Void
void vfnDMAStart ( const uint8_t  u8Chan)

This function will Start a DMA loop.

Parameters:
u8Chan,:Channel to be used (0 - 15)
Returns:
Void